Conversation
donovanh
left a comment
There was a problem hiding this comment.
Looking good - I've just thrown in some nitpicks
| --- | ||
|
|
||
| Coming soon. | ||
| <<<<<<< HEAD |
| // optional - there is no reason why this child process | ||
| // can't be called multiple times. | ||
| process.exit() | ||
| }) |
There was a problem hiding this comment.
Should this code have semi-colons?
|
|
||
| const child1 = fork('fork-child') | ||
| const child2 = fork('fork-child') | ||
| const child3 = fork('fork-child') |
There was a problem hiding this comment.
Semi-colons missing but present elsewhere
| ## A Simple `exec` | ||
|
|
||
| In this example, we will call the `ls` command to listwith the optional param `-l` to show a long list of details. | ||
| <div class="repl-code"> |
There was a problem hiding this comment.
Tiny nitpick: I'd adda line before the HTML code here to make it easier to scan
|
|
||
| ## A Simple `exec` | ||
|
|
||
| In this example, we will call the `ls` command to listwith the optional param `-l` to show a long list of details. |
|
|
||
| ``` | ||
| </div> | ||
|
|
There was a problem hiding this comment.
I'd maybe add a quick line saying what exec does here - may seem obvious but I think it helps to reinforce the point.
| ``` | ||
| </div> | ||
|
|
||
| In this example we are listening to the `stout` and `stderr` streams for `data` events, as well as listening for a `close` event. |
There was a problem hiding this comment.
Are these events different from the exec approach?
There was a problem hiding this comment.
Yes - exec buffers it to strints
There was a problem hiding this comment.
Strings.
I'll add that :)
|
|
||
| # fork | ||
|
|
||
| `fork` is a special version of `spawn' that allows messages to be sent between the Node processes. |
|
|
||
| Parents `spawm`, `fork` or `exec` child processes, and communicate via events or pipes. | ||
|
|
||
| Take me to [cheat sheet]({{ "/cheatsheet/#child-process" | url }}) |
There was a problem hiding this comment.
I'd stick a full stop after the link here :)
|
|
||
| ## Exercise | ||
|
|
||
| Create a child process for doing some manipulation of a file or URL, and build a parent process that controls a number of these processes in parallel. |
There was a problem hiding this comment.
Should this have a hidden suggested-solution? If too much to do, we can leave it for now.
There was a problem hiding this comment.
Yeah - I think there is more value in populating the other bits of content and we can come back to this, or maybe I can put a note in for someone to do one and put it up as a PR :)
There was a problem hiding this comment.
Added comment - thanks for all the comments and keeping me honest. Made a big improvement to this piece.
donovanh
left a comment
There was a problem hiding this comment.
Let's give this a whirl. Good job
No description provided.